package com.rocketmq.consumer.mq;

import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @program: awesome-spring
 * @description: 事务topic消费者
 * @author: Alex Wu
 * @createDate: 2025-02-11 16:36
 **/
@Component
@RocketMQMessageListener(consumerGroup="test-txRocketmq-group",topic="test-tx-rocketmq", messageModel = MessageModel.CLUSTERING)
public class TransactionConsumer implements RocketMQListener<String>
{
    @Override
    public void onMessage(String message)
    {
        // 多次消费失败，可以进入死信队列，由人工补偿
        System.out.println("send transaction mssage parma is: " + message);
    }
}
